package org.jeecg.modules.asset.query.controller;

import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.asset.query.entity.Query;
import org.jeecg.modules.asset.query.service.IQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @Description:   模糊查询
 * @Author: jeecg-boot
 * @Date:   2020-03-31
 * @Version: V1.0
 */
@RestController
@RequestMapping("/query/query")
@Slf4j
public class QueryController extends JeecgController<Query, IQueryService> {
	@Autowired
	private IQueryService queryService;

	/**
	 * 查询全部资产
	 */
	public List<Query> queryList(@RequestBody String common){
		return this.queryService.query(common);

	}

    /**
    * 导出excel
    *
    * @param request
    * @param people
    */
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, Query people) {
        return super.exportXls(request, people, Query.class, "  人员表");
    }

    /**
      * 通过excel导入数据
    *
    * @param request
    * @param response
    * @return
    */
    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
        return super.importExcel(request, response, Query.class);
    }

}
